package com.impress.commons.exception;

import org.assertj.core.util.Preconditions;
/**
 * 
 * @author LiuTao
 * @since 2017年3月20日
 */
public class RawErrorCodeException extends RuntimeException {

	private static final long serialVersionUID = -3532874199443623175L;

	private final ErrorCodeEntry errorCode;

	/**
	 * @param errorCode
	 */
	public RawErrorCodeException(ErrorCodeEntry errorCode) {
		super();
		this.errorCode = Preconditions.checkNotNull(errorCode, "the 'errorCode' argument must not be null");
	}

	/**
	 * @param errorCode
	 * @param cause
	 */
	public RawErrorCodeException(ErrorCodeEntry errorCode, Throwable cause) {
		super(cause);
		this.errorCode = Preconditions.checkNotNull(errorCode, "the 'errorCode' argument must not be null");
	}

	public ErrorCodeEntry getErrorCode() {
		return errorCode;
	}

	@Override
	public String getMessage() {
		return this.errorCode.toString();
	}
}
